// Copyright 2017-present the Material Components for iOS authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#import <UIKit/UIKit.h>

#import "MaterialShadowElevations.h"

@protocol MDCShapeGenerating;

/**
 MDCShapedView is a primitive view class which makes it easy to style the shape
 of the view's edges and corners.

 MDCShapedView manages mapping the paths generated by the shapeGenerator to the
 backing CAShapeLayer whenever the view is resized.
 */
@interface MDCShapedView : UIView

/**
 The elevation of the layer in points.

 The higher the elevation, the more spread out the shadow is. This is distinct from the layer's
 zPosition which can be used to order overlapping layers, but will have no affect on the size of
 the shadow.

 Negative values act as if zero were specified.
 */
@property(nonatomic, assign) MDCShadowElevation elevation;

/**
 The shape generator used to generate a new CGPath whenever the view is resized.
 */
@property(nonatomic, strong, nullable) IBOutlet id<MDCShapeGenerating> shapeGenerator;

/**
 The stroke color of the shape generated by shapeGenerator.

 The default is nil, which results in no stroke being drawn.
 */
@property(nonatomic, copy, nullable) UIColor *shapedBorderColor;

/**
 The stroke width of the shape generated by shapeGenerator.

 The default is 0, which results in no stroke being drawn.
 */
@property(nonatomic, assign) CGFloat shapedBorderWidth;

/**
 Initializes an MDCShapedView.

 @param frame The frame of the shaped view.
 @param shapeGenerator The shape generator used to set the shape of the view.
 */
- (nonnull instancetype)initWithFrame:(CGRect)frame
                       shapeGenerator:(nullable id<MDCShapeGenerating>)shapeGenerator
    NS_DESIGNATED_INITIALIZER;

@end
